1、使用百分比时,参考的是父级的尺寸
2、使用正值是,元素领地会扩张,使用负值时,元素领地会收缩
3、外边距的设置和圆角很相似
1)margin: 上 右 下 左
margin:10px 20px 30px 40px
从上到左,顺时针的顺序
2)margin:上 右和下 左
margin:10px 20px 30px
3)margin:上右和下左
margin:10px 30px
4)margin: 4个方向一样的值
margin:30px
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>css</title>
<style type="text/css">
.laoLiu{
width:100px;height:100px;background:#E1EFFF;
margin:-20px 30px 60px 100px;
}
.laoQi{
width:100px;height:100px;background:#E1EFFF;
margin:30px;
}
</style>
</head>
<body>
<div style="background:gray;height:10px;"></div>
<div class="laoLiu"></div>
<div style="background:gray;height:10px;"></div>
<br>
<div style="background:purple;height:10px;"></div>
<div class="laoQi"></div>
<div style="background:purple;height:10px;"></div>
</body>
</html>
返回值 :